using System;
using System.Collections.Generic;
using System.Text;

namespace My.IdlConverter.Core.Graphics
{
    [Serializable]
    public class ClassNode
    {
        private IList<ClassNode> _childNodes = new List<ClassNode>();
        private Interface _referObj;
        private ClassNode _parent;

        public ClassNode()
        {
        }

        public ClassNode(Interface referObj)
            :this(referObj,null)
        {
        }

        public ClassNode(Interface referObj, ClassNode parent)
        {
            _referObj = referObj;
            _parent = parent;
        }

        public virtual IList<ClassNode> ChildNodes
        {
            get
            {
                return _childNodes;
            }
        }

        public bool IsLeaf()
        {
            return (ChildNodes.Count==0);
        }

        public virtual bool IsRoot()
        {
            return (_parent==null);
        }

        public ClassNode Parent
        {
            get
            {
                return _parent;
            }
            set
            {
                _parent = value;
            }
        }

        public Interface ReferObj
        {
            get
            {
                return _referObj;
            }
        }
    }
}
